package cn.com.open.opensaas.scoreservice.mapper;

import cn.com.open.opensaas.scoreservice.domain.OperateLogModel.OperateLog;
import cn.com.open.opensaas.scoreservice.sqlprovider.OperateLogSqlProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Mapper;

@Mapper
public interface OperateLogMapper {
	/**
	 * 保存日志
	 * @param operateLog
	 * @return
	 */
	@Insert("insert into OperateLog(ID,UserID,OptUrl,Area,Controller,Action,OptType,OptTime,OptIP,OptDescription)\n" +
			" values\n" +
			" (NEWID(),#{userId},#{optUrl},#{area},#{controller},#{action},#{optType},#{optTime},#{optIp},#{optDescription})")
	void saveLog(OperateLog operateLog);

	/**
	 * Insert 日志信息.
	 *
	 * @param model 日志信息
	 * @return the int
	 */
	@InsertProvider(type = OperateLogSqlProvider.class, method = "insert")
	int insert(OperateLog model);
}